cmake_minimum_required(VERSION 3.5)

project(mypro2buf LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

# 查找指定目录下的所有.cpp与.h文件 并存放到指定变量名SC_FILES中
FILE(GLOB SC_FILES "*.cpp" "*.h")

add_executable(mypro2buf ${SC_FILES})

install(TARGETS mypro2buf
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

if(CMAKE_HOST_WIN32)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/gtest/include)
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/gtest/lib)
target_link_libraries(mypro2buf ${CMAKE_CURRENT_SOURCE_DIR}/gtest/lib/gtest.lib)
elseif(CMAKE_HOST_UNIX)
target_link_libraries(mypro2buf gtest)
target_link_libraries(mypro2buf pthread)
else()
endif()
